<template>
	<view class="searchBar">
		<uni-search-bar @confirm="search" cancelButton="none" v-model="searchValue"
			:placeholder="placeholder||'药方名称'"></uni-search-bar>
		<view class="btn" @click="searchBtn()">
			搜索
		</view>
	</view>
</template>

<script>
	export default {
		name: "searchBar",
		props: ["placeholder"],
		data() {
			return {
				searchValue: ''
			};
		},
		methods: {
			chenge(e) {
				this.$nextTick(() => {
					this.$emit("chenge", e)
				})
			},
			searchBtn() {
				this.chenge(this.searchValue)
			},
			search(res) {
				this.chenge(this.searchValue)
			},
		}
	}
</script>

<style lang="less" scoped>
	.searchBar {
		background-color: #fff;
		display: flex;
		align-items: center;

		.btn {
			width: 105rpx;
			padding-right: 40rpx;
			box-sizing: border-box;
			font-weight: 500;
			font-size: 28rpx;
			color: #3B6CFE;
			text-align: center;
		}
	}

	.uni-searchbar {
		flex: 1;
	}

	/deep/.uni-searchbar__box {
		justify-content: left;
		border-radius: 60rpx !important;
	}
</style>